<?php 
class exportsAction extends AdminMaster{
	public function execute($request){
		$this->data['navigation']	= __('module_exports',null,'menu').' › '. __('module_exports_action_exports',null,'menu');
		
		//$this->data['list']['cates'] = ;
		
		switch ($this->data['action']){
			case ADMIN_DEFINED::DELETE_RECORD:
				$this->delRecord();
				break;
			#MORE ACTION HERE
			default:
				$this->filterList();
				break;
		}

		$this->setVar('data', $this->data);
	}
	private function filterList(){
		$this->setAction();
		$this->addSelectExport();
		
		$this->data['navigation'].=' › '. __('nav_list',null,'table_list');
		
		$this->data['list']			 		= ExportsTable::getDataList($this->data['filter'], $this->data['pagination']);
		
		$this->data['pagination']['total']		= ExportsTable::getDataListCount($this->data['filter']);
		$this->data['pagination']['router']		= 'export_list';
		$this->data['pagination']['params']		= $this->data['filter'];
		$pag = new PaginationHelper2($this->data['pagination']);
		$this->data['pagination_pager']	= $pag->getPaginations();
		if($this->data['filter']['filter_key'] == '*'){
			$this->data['filter']['filter_key'] = '';
		}
	}
	private function delRecord(){
		ExportsTable::delete($this->data['select_list']);
		$this->filterList();
	}
	private function addSelectExport(){
		$this->data['export_select'] = array(
				'source',
				'fullname',
				'idcard',
				'gender',
				'birthday',
				'married',
				'job_hope',
				'private',
				'current_address',
				'home_address',
				'email',
				'phone_number',
				'education',
				'education_history',
				'major',
				'language',
				'it',
				'other_major',
				'salary',
				'working_status',
				'working_history',
				'remark'
		);
	}
	
	#ACTION FOR EACH ROW
	private function setAction(){
		$action = array();
		$action[]=array(
				'href'	=>	'?action_name='.ADMIN_DEFINED::EDIT_RECORD.'&id=%s',
				'text'	=>	__('action_edit',null,'table_list'),
				'title' =>	__('action_edit',null,'table_list'),
		);
	
		$this->data['action_list']	= $action;
	}
}